<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  </head>
  <body>
    <script>
      let a = ['tom', 'yahoo', 'github']
      //异开

      //   let b = [...a]
      //   for (const value of a) {
      //     b.push(value)
      //   }
      //   console.table(b)
      //   let [, , f, e = 'sina'] = a
      //   console.log(e)

      //   function sum(...nums) {
      //     let sum = 0
      //     for (const value of nums) {
      //       sum += value
      //     }
      //     return sum
      //   }

      //   console.log(sum(1, 2, 3, 4, 45))
      let num = [1, 2, 3]
      let res = num.reduce((a, b) => {
        return a + b
      }, 0)

      console.log(res)
    </script>
  </body>
</html>
